#include<iostream>
#include<vector>
using namespace std;
const int N = 1000;
char s[N][N];
int n;
vector<int>ans;
int main()
{
	cin >> n;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 4 * n; j++) {
			cin >> s[i][j];
			//	cout<<s[i][j]<<" ";
		}
		//cout<<endl;
	}
	for (int i = 0; i < 4 * n; i += 4) {
		int cnt = 0;
		for (int j = i;; j++) {
			cnt++;
			//cout<<"j=="<<j<<endl;
			if (s[3][j] == '*') {
				if (cnt == 1)	ans.push_back(2);
				else if (cnt == 2)	ans.push_back(1);
				else ans.push_back(3);
				break;
			}
		}
	}
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
	}
	return 0;
}